package com.education.wisdom.service.impl;

import com.education.common.utils.Convert;
import com.education.common.utils.UUIDUtils;
import com.education.wisdom.mapper.RecordedMapper;
import com.education.wisdom.pojo.Recorded;
import com.education.wisdom.service.IRecordedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 录播资源 服务层实现
 * 
 * @author ruoyi
 * @date 2018-12-13
 */
@Service
public class RecordedServiceImpl implements IRecordedService
{
	@Autowired
	private RecordedMapper recordedMapper;

	/**
     * 查询录播资源信息
     * 
     * @param id 录播资源ID
     * @return 录播资源信息
     */
    @Override
	public Recorded selectRecordedById(Integer id)
	{
	    return recordedMapper.selectRecordedById(id);
	}
	
	/**
     * 查询录播资源列表
     * 
     * @param recorded 录播资源信息
     * @return 录播资源集合
     */
	@Override
	public List<Recorded> selectRecordedList(Recorded recorded)
	{
	    return recordedMapper.selectRecordedList(recorded);
	}
	
    /**
     * 新增录播资源
     * 
     * @param recorded 录播资源信息
     * @return 结果
     */
	@Override
	public int insertRecorded(Recorded recorded)
	{	
		recorded.setRNumber(UUIDUtils.getByUUId());
		recorded.setCreateTime(new Date());
	    return recordedMapper.insertRecorded(recorded);
	}
	
	/**
     * 修改录播资源
     * 
     * @param recorded 录播资源信息
     * @return 结果
     */
	@Override
	public int updateRecorded(Recorded recorded)
	{
	    return recordedMapper.updateRecorded(recorded);
	}

	/**
     * 删除录播资源对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteRecordedByIds(String ids)
	{
		return recordedMapper.deleteRecordedByIds(Convert.toStrArray(ids));
	}
	
}
